<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function craps_game() {
            var num1 = parseInt(prompt('请输入1-6之间的数'));
            var num2 = parseInt(prompt('请输入1-6之间的数'));
            var res = num1 + num2;

            if (res == 7 || res == 11) {
                return '玩家胜利'
            }
            else if (res == 2 || res == 3 || res == 12) {
                return '庄家赢'
            }
            else {
                var point = res; //记录第一次的点数 
                while (true) {
                    var num3 = parseInt(prompt('请输入1-6之间的数'));
                    var num4 = parseInt(prompt('请输入1-6之间的数'));
                    var data = num3 + num4;
                    if (data == 7) {
                        return '庄家赢'
                    }
                    else if (data == point) {
                        return '玩家胜利'
                    }
                }
            }
        }

        console.log(craps_game())
    </script>
</body>

</html>